//
//  CGameManage.cpp
//  MyPlaneGame
//
//  Created by yeates on 16/6/9.
//  Copyright (c) 2016年 yeates. All rights reserved.
//

#include "CGameManage.h"

CGameManage::CGameManage(){
    cvNamedWindow("window");    //新建游戏窗口
    IplImage *TempImg  = cvLoadImage("./resource/bg.jpg");
    Game_Ui.SetBgImage(TempImg);
}

CGameManage::~CGameManage(){

}

void CGameManage::RunGame(){
    while(1){
        Game_Ui.Build();
        MyPlaneUpdate();
        Game_Ui.ShowBgImage();
        cvWaitKey(20);              //20毫秒更新一次屏幕
    }
}

void CGameManage::MyPlaneUpdate(){
    IplImage *Bg = Game_Ui.GetNowImage();
    My_Plane.Draw(Bg);
}